<?php

    function my_get_file_content($url) {
        $ch=curl_init();
        $timeout=5;
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
        $img=curl_exec($ch);
        $ret=curl_getinfo($ch,CURLINFO_HTTP_CODE);
        curl_close($ch);
        return array($img,$ret);
    }
    
    function my_get_file_content2($ip, $msg) {
        $data0 = array('cmd'=>'gm','param'=>$msg);
        $data = http_build_query($data0);
        $options = array('http' => array('method' => 'GET', 'header'  => 'Content-type:application/x-www-form-urlencoded', 'timeout'=>3));
        $context = stream_context_create($options);
        $url = $ip . "?" . $data;
        $output = file_get_contents($url,false,$context);
        return $output;
    }